﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using VivahMuhurth.DBAccess;

public partial class RegisterProfile : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        lblStatus.Visible = false;
    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        if(true)// do all validations.
        {
            //int UserFreeTrialMonths = ConfigurationManager.AppSettings["UserFreeTrialMonths"] != null ? Convert.ToInt32(ConfigurationManager.AppSettings["UserFreeTrialMonths"].ToString()) : Constants.DefaultFreeTrialMonths;
            DBAccess dBAccess = new DBAccess();

            DataTable result = dBAccess.ValidateUser(txtEmail.Text, txtPassword.Text);

            if (result != null && result.Rows.Count > 0)
            {
                Session[Constants.UserSession] = result.Rows[0][Constants.loginId];
                Session[Constants.LoginFullName] = result.Rows[0][Constants.FullName];
                Response.Redirect("RegisterProfile.aspx");
            }
            {
                lblStatus.Visible = true;
                clearControls();
            }
            //lblStatus.Text = response > 0 ? Resources.Resource.SignUpSuccess : Resources.Resource.SignUpFailure;

        }
    }
    private void clearControls()
    {
        txtEmail.Text = txtPassword.Text = string.Empty;
    }
}
